using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace OutpatientApi.DTO
{
    /// <summary>
    /// 修改药品信息Dto
    /// </summary>
    public class UpdateMedicineDto
    {
        /// <summary>
        /// 药品ID - 必填
        /// </summary>
        [Required(ErrorMessage = "药品ID不能为空")]
        public int MedicineId { get; set; }

        /// <summary>
        /// 药品名称
        /// </summary>
        [Required(ErrorMessage = "药品名称不能为空")]
        [StringLength(50, ErrorMessage = "药品名称长度不能超过50个字符")]
        public string MedicineName { get; set; } = string.Empty;

        /// <summary>
        /// 药品类型(如:西药、中药等)
        /// </summary>
        [StringLength(50, ErrorMessage = "药品类型长度不能超过50个字符")]
        public string DrugType { get; set; } = string.Empty;

        /// <summary>
        /// 药品费用名称(如:西药费、中药费等)
        /// </summary>
        [StringLength(50, ErrorMessage = "费用名称长度不能超过50个字符")]
        public string FeeName { get; set; } = string.Empty;

        /// <summary>
        /// 剂型(如:片剂、颗粒等)
        /// </summary>
        [StringLength(50, ErrorMessage = "剂型长度不能超过50个字符")]
        public string DosageForm { get; set; } = string.Empty;

        /// <summary>
        /// 规格
        /// </summary>
        [StringLength(50, ErrorMessage = "规格长度不能超过50个字符")]
        public string Specification { get; set; } = string.Empty;

        /// <summary>
        /// 进价(单位:元)
        /// </summary>
        [Column(TypeName = "decimal(10,2)")]
        [Range(0, 999999.99, ErrorMessage = "进价必须在0-999999.99之间")]
        public decimal? PurchasePrice { get; set; }

        /// <summary>
        /// 售价(单位:元)
        /// </summary>
        [Column(TypeName = "decimal(10,2)")]
        [Required(ErrorMessage = "售价不能为空")]
        [Range(0.01, 999999.99, ErrorMessage = "售价必须在0.01-999999.99之间")]
        public decimal SellingPrice { get; set; }

        /// <summary>
        /// 库存数量
        /// </summary>
        [Required(ErrorMessage = "库存数量不能为空")]
        [Range(0, int.MaxValue, ErrorMessage = "库存数量必须大于等于0")]
        public int StockQuantity { get; set; }

        /// <summary>
        /// 库存上限
        /// </summary>
        [Range(0, int.MaxValue, ErrorMessage = "库存上限必须大于等于0")]
        public int? StockUpperLimit { get; set; }

        /// <summary>
        /// 库存下限
        /// </summary>
        [Range(0, int.MaxValue, ErrorMessage = "库存下限必须大于等于0")]
        public int? StockLowerLimit { get; set; }

        /// <summary>
        /// 生产日期
        /// </summary>
        [Required(ErrorMessage = "生产日期不能为空")]
        public DateTime ProductionDate { get; set; }

        /// <summary>
        /// 有效日期
        /// </summary>
        [Required(ErrorMessage = "有效日期不能为空")]
        public DateTime ExpirationDate { get; set; }

        /// <summary>
        /// 病功效
        /// </summary>
        [Column(TypeName = "text")]
        public string Efficacy { get; set; } = string.Empty;
    }
}
